# Use Autessa in your existing project

Source: https://docs.autessa.com/docs/integrations/existing-project

> Add Autessa's firewall, SecurePass redaction, evaluations, synthetic data and deployed agents to the project you already have, with LangChain, the Vercel AI SDK, LiteLLM, MCP, Pipecat or LiveKit, in about five lines each.

# Use Autessa in your existing project

Keep your framework, your model and your code. Pick the Autessa feature you need and add it in about five lines. Each package works on its own and reads your key from `AUTESSA_API_KEY`.

All packages are in private preview. Install steps are on each linked page.

| You want to | Use | Page |
| --- | --- | --- |
| Block prompt injection and data leaks | Firewall middleware for LangChain, Vercel AI SDK, LiteLLM, MCP, Pipecat or LiveKit | [AI Application Firewall](/docs/features/ai-application-firewall.md) |
| Remove card numbers and health data from call audio | SecurePass processor for Pipecat or LiveKit | [SecurePass](/docs/features/securepass.md) |
| Grade conversations and attack-test your agent | Graders for LangChain, Vercel AI SDK, Pipecat and LiveKit; the `evals` package; the eval action in CI | [Evaluations](/docs/features/evaluations.md) |
| Make realistic test data | LangChain loader, Vercel AI SDK dataset, MCP tools, or the `synth` package | [Synthetic data](/docs/features/synthetic-data.md) |
| Call an agent you deployed on Autessa | LangChain Runnable or tool, Vercel AI SDK tool, MCP tools, or the `agents` package | [Call your agents from code](/docs/features/agents.md) |

Get a key first: [get a free API key](https://builder.autessa.com/get-api-key), then `export AUTESSA_API_KEY="<keyId>:<secret>"`.

## Firewall

**LangChain (Python).** Add the middleware to your agent:

```python
from langchain.agents import create_agent
from langchain_anthropic import ChatAnthropic
from langchain_autessa import AutessaFirewallMiddleware

agent = create_agent(ChatAnthropic(model="claude-opus-5-5"), tools=[], middleware=[AutessaFirewallMiddleware()])
```

**Vercel AI SDK.** Wrap your model:

```typescript
import { anthropic } from "@ai-sdk/anthropic";
import { wrapLanguageModel } from "ai";
import { autessaFirewall } from "@autessa/ai-sdk";

const model = wrapLanguageModel({ model: anthropic("claude-opus-5-5"), middleware: autessaFirewall() });
```

**LiteLLM.** Run the guardrail service, then add it to your LiteLLM config:

```yaml
litellm_settings:
  guardrails:
    - guardrail_name: autessa-input
      litellm_params: { guardrail: generic_guardrail_api, mode: pre_call, api_base: http://localhost:8080, api_key: os.environ/GUARDRAIL_API_KEY }
```

**MCP.** Put the firewall in front of any MCP server you already use:

```bash
claude mcp add notes --env AUTESSA_API_KEY="$AUTESSA_API_KEY" -- \
  npx -y @autessa/mcp-firewall -- npx -y your-notes-mcp-server
```

**LiveKit Agents.** Use `AutessaFirewallAgent` in place of `Agent`:

```python
from livekit.plugins.autessa import AutessaFirewall, AutessaFirewallAgent

agent = AutessaFirewallAgent(instructions="You help customers with their orders.",
                             firewall=AutessaFirewall(session_id=ctx.room.name))
await session.start(agent=agent, room=ctx.room)
```

Pipecat has `AutessaFirewallProcessor`. See [Pipecat](/docs/integrations/pipecat.md).

A new company's policy only records what it finds. To block, use a policy in Enforce mode and pass its name (`policy_name` / `policyName`).

## SecurePass

**Pipecat.** Add the recorder after the output transport. It redacts the full call when the call ends:

```python
from pipecat_autessa_redact import AutessaRedactionProcessor

recorder = AutessaRedactionProcessor(external_id="call-42", types=["CARD_NUMBER", "CARD_CVV"], on_result=print)
pipeline = Pipeline([transport.input(), stt, aggregators.user(), llm, tts,
                     transport.output(), recorder, aggregators.assistant()])
```

**LiveKit Agents.** Attach the recorder to your session:

```python
from livekit.plugins.autessa import AutessaRecorder

recorder = AutessaRecorder(external_id=ctx.room.name, types=["CARD_NUMBER", "CARD_CVV"], on_result=print)
recorder.attach(session)
ctx.add_shutdown_callback(recorder.finish)
```

## Evaluations

**LangChain.** Grade an agent run:

```python
from langchain_autessa import AutessaGrader

result = agent.invoke({"messages": [("user", "Where is order 1042?")]})
graded = AutessaGrader("You help customers track orders.").grade(result, expected_outcome="The agent gives the order status.")
print(graded.passed)
```

`AutessaGradingCallback` grades every run you pass it as a callback.

**Vercel AI SDK.** Grade a `generateText` run, including its tool calls:

```typescript
import { gradeGeneration } from "@autessa/ai-sdk";

const result = await generateText({ model, system, prompt, tools, stopWhen: stepCountIs(5) });
const { passed } = await gradeGeneration({ result, system, prompt, expectedOutcome: "Gives the order status." });
```

**Pipecat.** Grade each finished call. `grader.user()` goes after speech to text, the grader after the LLM:

```python
from pipecat_autessa_evals import AutessaCallGrader

grader = AutessaCallGrader(agent_instructions="You book dental cleanings.", on_result=print)
pipeline = Pipeline([transport.input(), stt, grader.user(), aggregators.user(), llm,
                     grader, tts, transport.output(), aggregators.assistant()])
```

**LiveKit Agents.** Attach the grader to your session. It grades the call when the session closes:

```python
from livekit.plugins.autessa import AutessaCallGrader

grader = AutessaCallGrader(expected_outcome="The customer gets their order status.", on_result=print)
await session.start(agent=agent, room=ctx.room)
grader.attach(session)
```

Pipecat and LiveKit also have `grade_transcript()` for transcripts you collected elsewhere. Without a framework, use the [evals package](/docs/features/evaluations.md). To attack-test your agent's endpoint on every pull request, add the [eval action](/docs/integrations/github-actions.md).

## Synthetic data

**LangChain.** Load made-up rows as documents, or as grading cases:

```python
from langchain_autessa import AutessaSynthLoader

docs = AutessaSynthLoader(description="Support tickets for a phone company", row_count=5).load()
cases = AutessaSynthLoader(description="Order questions with the expected outcome", row_count=20).load_eval_cases(
    {"user": "question", "expected_outcome": "expected"}, agent_instructions="You help customers.")
```

**Vercel AI SDK.** Get rows and test cases for `generateText` tests:

```typescript
import { autessaBuildDataset } from "@autessa/ai-sdk";

const { rows, cases } = await autessaBuildDataset({
  description: "customers asking a bike shop about late orders, with what a good answer does",
  rowCount: 20,
  cases: { user: "question", expectedOutcome: "expected", agentInstructions: "You help with orders." },
});
```

Without a framework, use the [synth package](/docs/features/synthetic-data.md#the-synth-package): `generate`, then `toEvalCases` or `toSeed`.

## Agents

Hand work to an agent you deployed on Autessa. It answers with its own instructions, tools and firewall policy.

**LangChain.** A Runnable, and a tool another agent can delegate to:

```python
from langchain_autessa import AutessaAgent

support = AutessaAgent(agent_id="V1StGXR8Z5", name="support_agent", description="Answers order questions.")
agent = create_agent(model, tools=[support.as_tool()])
```

In JavaScript: `new AutessaAgent({ agentId, name, description }).asTool()`.

**Vercel AI SDK.** An AI SDK tool:

```typescript
import { autessaAgentTool } from "@autessa/ai-sdk";

const billing = autessaAgentTool({ agentId: "V1StGXR8Z5", description: "Answers billing and refund questions" });
const { text } = await generateText({ model, tools: { billing }, stopWhen: stepCountIs(5), prompt: "Why was I charged twice?" });
```

**MCP.** Turn on the agent and synthetic data tools (`agent_*` and `synth_*`). They are off by default:

```bash
claude mcp add autessa-tools --env AUTESSA_API_KEY="$AUTESSA_API_KEY" -- npx -y @autessa/mcp-tools --include builtin,tenant,agents,synth
```

From your own code, use the [agents package](/docs/features/agents.md). To build the agent itself in code, see [Build an agent in code](/docs/cdk/agents.md).

## Related

- [Integrations](/docs/integrations.md)
- [Features](/docs/features.md)
- [Autessa CDK](/docs/cdk.md)
- [API keys and scopes](/docs/start/api-keys.md)

