# Connect Your API

Source: https://docs.generalaugment.com/guides/connect-your-api/
Description: Generate agent tools from an OpenAPI spec.

The integration pipeline turns OpenAPI operations into curated MCP tools. Use this when
your app wants General Augment to call back into app-owned functionality without putting
raw credentials or arbitrary function handlers inside `/v1/responses`.

## CLI flow

```bash
genaug integrate https://api.example.com/openapi.json \
  --name health-agent \
  --description "Health record assistant"
```

The CLI detects auth schemes, classifies operations, and writes generated tool files.

```text
Generated 14 tools from 24 endpoints
State      Tool                Method  Risk    Approval
enabled    get_health_records  GET     low     no
enabled    log_symptom         POST    medium  yes
disabled   delete_account      DELETE  high    yes
```

Generated governance defaults should be visible in both CLI output and the dashboard:
read tools can auto-execute, write tools require approval, and destructive tools stay
disabled until explicitly enabled. Review the scaffold, then deploy it:

```bash
genaug deploy ./health-agent/genaug-agent.yaml
```

Use `--auto-deploy` on `genaug integrate` when you want the CLI to create or update the
project and register the generated OpenAPI tools in one pass. After deploy, run:

```bash
genaug smoke --project health-agent --json
genaug onboarding verify --project health-agent --json
```

The verify artifact should prove the same tenant can call `/v1/responses`, resolve
tools, write usage/trace rows, and expose dashboard URLs. Keep trace or audit evidence
for any tool-call behavior you plan to launch.

## Credential Boundary

Generated tools should not contain raw credentials. The agent sees sanitized tool
schemas and calls the auth proxy or your app backend. Credentials are resolved
server-side, scoped by project, user, and provider, then injected into the outbound
request outside the model.

If your app already owns user OAuth for Gmail, Calendar, CRM, or another API, keep
executing those actions in your backend for the first version. Use `/v1/responses` for
reasoning, summaries, structured drafts, or action proposals, then delegate the tool
only after General Augment credentials, identity links, allowlists, and approval UX are
connected.

Allowlisting a tool only makes it available to the managed agent runtime. It does not bypass credential,
identity, approval, audit, or redaction checks.

## App-defined callbacks

For custom tools, expose your app capability as either:

- an OpenAPI operation that General Augment converts into a project-defined tool; or
- a hosted MCP server listed under `tools.mcp`.

A Spark-style `draft_spark_email` action, for example, should live behind Spark's
backend and be registered as a project-defined tool. General Augment exposes only the
sanitized schema to the managed agent runtime, routes execution through the configured server or auth
proxy, and applies the project's allowlist, audit, timeout, and approval policy.

Inline Responses API function callbacks are not the stable public tool interface today.
MCP and generated OpenAPI tools are the app-defined callback boundary.

## REST flow

```bash
curl -sS https://api.generalaugment.com/api/v1/admin/projects/from-config \
  -H "X-Admin-Key: gaadmlive_your_key_here" \
  -H "Content-Type: application/json" \
  -d @payload.json

curl -sS https://api.generalaugment.com/api/v1/admin/projects/$PROJECT_ID/tools/from-openapi \
  -H "X-Admin-Key: gaadmlive_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "spec_url": "https://api.example.com/openapi.json",
    "target_count": 15,
    "auto_deploy": true
  }'
```

## Python HTTP flow

```python
from pathlib import Path

response = httpx.post(
    "https://api.generalaugment.com/api/v1/admin/projects/from-config",
    headers={"X-Admin-Key": "gaadmlive_your_key_here"},
    json={"yaml_content": Path("genaug-agent.yaml").read_text()},
    timeout=30,
)
response.raise_for_status()
project = response.json()

registration = httpx.post(
    f"https://api.generalaugment.com/api/v1/admin/projects/{project['id']}/tools/from-openapi",
    headers={"X-Admin-Key": "gaadmlive_your_key_here"},
    json={
        "spec_url": "https://api.example.com/openapi.json",
        "target_count": 15,
        "auto_deploy": True,
    },
    timeout=30,
)
registration.raise_for_status()
print(project["slug"], registration.json()["enabled_tool_ids"])
```

Next, tune the result in [Configure Tools](/guides/configure-tools/).
