rossum-agent 1.0.0rc0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. rossum_agent/__init__.py +9 -0
  2. rossum_agent/agent/__init__.py +32 -0
  3. rossum_agent/agent/core.py +932 -0
  4. rossum_agent/agent/memory.py +176 -0
  5. rossum_agent/agent/models.py +160 -0
  6. rossum_agent/agent/request_classifier.py +152 -0
  7. rossum_agent/agent/skills.py +132 -0
  8. rossum_agent/agent/types.py +5 -0
  9. rossum_agent/agent_logging.py +56 -0
  10. rossum_agent/api/__init__.py +1 -0
  11. rossum_agent/api/cli.py +51 -0
  12. rossum_agent/api/dependencies.py +190 -0
  13. rossum_agent/api/main.py +180 -0
  14. rossum_agent/api/models/__init__.py +1 -0
  15. rossum_agent/api/models/schemas.py +301 -0
  16. rossum_agent/api/routes/__init__.py +1 -0
  17. rossum_agent/api/routes/chats.py +95 -0
  18. rossum_agent/api/routes/files.py +113 -0
  19. rossum_agent/api/routes/health.py +44 -0
  20. rossum_agent/api/routes/messages.py +218 -0
  21. rossum_agent/api/services/__init__.py +1 -0
  22. rossum_agent/api/services/agent_service.py +451 -0
  23. rossum_agent/api/services/chat_service.py +197 -0
  24. rossum_agent/api/services/file_service.py +65 -0
  25. rossum_agent/assets/Primary_light_logo.png +0 -0
  26. rossum_agent/bedrock_client.py +64 -0
  27. rossum_agent/prompts/__init__.py +27 -0
  28. rossum_agent/prompts/base_prompt.py +80 -0
  29. rossum_agent/prompts/system_prompt.py +24 -0
  30. rossum_agent/py.typed +0 -0
  31. rossum_agent/redis_storage.py +482 -0
  32. rossum_agent/rossum_mcp_integration.py +123 -0
  33. rossum_agent/skills/hook-debugging.md +31 -0
  34. rossum_agent/skills/organization-setup.md +60 -0
  35. rossum_agent/skills/rossum-deployment.md +102 -0
  36. rossum_agent/skills/schema-patching.md +61 -0
  37. rossum_agent/skills/schema-pruning.md +23 -0
  38. rossum_agent/skills/ui-settings.md +45 -0
  39. rossum_agent/streamlit_app/__init__.py +1 -0
  40. rossum_agent/streamlit_app/app.py +646 -0
  41. rossum_agent/streamlit_app/beep_sound.py +36 -0
  42. rossum_agent/streamlit_app/cli.py +17 -0
  43. rossum_agent/streamlit_app/render_modules.py +123 -0
  44. rossum_agent/streamlit_app/response_formatting.py +305 -0
  45. rossum_agent/tools/__init__.py +214 -0
  46. rossum_agent/tools/core.py +173 -0
  47. rossum_agent/tools/deploy.py +404 -0
  48. rossum_agent/tools/dynamic_tools.py +365 -0
  49. rossum_agent/tools/file_tools.py +62 -0
  50. rossum_agent/tools/formula.py +187 -0
  51. rossum_agent/tools/skills.py +31 -0
  52. rossum_agent/tools/spawn_mcp.py +227 -0
  53. rossum_agent/tools/subagents/__init__.py +31 -0
  54. rossum_agent/tools/subagents/base.py +303 -0
  55. rossum_agent/tools/subagents/hook_debug.py +591 -0
  56. rossum_agent/tools/subagents/knowledge_base.py +305 -0
  57. rossum_agent/tools/subagents/mcp_helpers.py +47 -0
  58. rossum_agent/tools/subagents/schema_patching.py +471 -0
  59. rossum_agent/url_context.py +167 -0
  60. rossum_agent/user_detection.py +100 -0
  61. rossum_agent/utils.py +128 -0
  62. rossum_agent-1.0.0rc0.dist-info/METADATA +311 -0
  63. rossum_agent-1.0.0rc0.dist-info/RECORD +67 -0
  64. rossum_agent-1.0.0rc0.dist-info/WHEEL +5 -0
  65. rossum_agent-1.0.0rc0.dist-info/entry_points.txt +3 -0
  66. rossum_agent-1.0.0rc0.dist-info/licenses/LICENSE +21 -0
  67. rossum_agent-1.0.0rc0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,102 @@
1
+ # Rossum Deployment Skill
2
+
3
+ **Goal**: Deploy configuration changes safely via sandbox with before/after diff.
4
+
5
+ ## Credential Identification
6
+
7
+ **Identify tokens BEFORE any deployment operation.** User may provide tokens with unclear naming.
8
+
9
+ | Identification Method | How to Apply |
10
+ |-----------------------|--------------|
11
+ | Check organization ID | Use `get_organization(org_id)` with each token to see org name - sandbox orgs typically contain "sandbox", "test", or "dev" |
12
+ | Check org URL pattern | Sandbox orgs often use different base URLs or have distinct naming conventions |
13
+ | Ask user explicitly | If tokens are ambiguous, ask: "Which token is for production and which for sandbox?" |
14
+ | Default env token = production | Token in `ROSSUM_API_TOKEN` env var is production (your main connection) |
15
+
16
+ **Constraint**: Never assume which token is prod/sandbox. Verify or ask.
17
+
18
+ ## Credential Rules
19
+
20
+ **Every tool call touches exactly one environment. Know which one before calling.**
21
+
22
+ | Call Pattern | Environment Affected |
23
+ |--------------|---------------------|
24
+ | `get_schema(...)`, `update_schema(...)`, any direct MCP tool | **PRODUCTION** |
25
+ | `call_on_connection("sandbox", "update_schema", ...)` | Sandbox |
26
+ | `deploy_copy_workspace(..., target_token=SANDBOX_TOKEN)` | Copies FROM production TO sandbox |
27
+ | `deploy_pull(..., token=SANDBOX_TOKEN)` | Pulls FROM sandbox |
28
+ | `deploy_pull(..., token=PROD_TOKEN)` or no token | Pulls FROM production |
29
+ | `deploy_to_org(..., target_token=SANDBOX_TOKEN)` | Deploys TO sandbox |
30
+ | `deploy_to_org(..., target_token=PROD_TOKEN)` | **Deploys TO PRODUCTION** |
31
+
32
+ **Sandbox modifications**: Always use `call_on_connection("sandbox", tool_name, args)`. Direct MCP calls modify production.
33
+
34
+ ## Workflow
35
+
36
+ Execute steps 1-5 autonomously. **Only pause at step 5 for user approval.**
37
+
38
+ | Step | Tool | Token/Connection |
39
+ |------|------|------------------|
40
+ | 1. Copy to sandbox | `deploy_copy_workspace` | `target_token=SANDBOX_TOKEN` |
41
+ | 2. Pull BEFORE | `deploy_pull` → `./before` | `token=SANDBOX_TOKEN` |
42
+ | 3. Modify sandbox | `call_on_connection("sandbox", ...)` | Via spawned connection |
43
+ | 4. Pull AFTER | `deploy_pull` → `./after` | `token=SANDBOX_TOKEN` |
44
+ | 5. Compare + show diff | `deploy_compare_workspaces` → display to user | **Wait for approval** |
45
+ | 6. Deploy to prod | `deploy_to_org` | `target_token=PROD_TOKEN` |
46
+
47
+ Step 3: Never use direct MCP calls (`update_schema`, `update_queue`, etc.) - those modify production.
48
+
49
+ ## Key Constraints
50
+
51
+ | Constraint | Rule |
52
+ |------------|------|
53
+ | Pull before compare | **Never call `deploy_compare_workspaces` without first pulling both directories via `deploy_pull`**. Comparison requires local JSON files - there is nothing to compare without pulling first. |
54
+ | Pull BEFORE immediately | After `deploy_copy_workspace`, immediately run `deploy_pull` to `./before`. This captures the baseline. |
55
+ | Pull AFTER last | After all sandbox modifications, run `deploy_pull` to `./after`. Then compare. |
56
+ | Spawned connections don't persist | Re-spawn `spawn_mcp_connection` each conversation turn. |
57
+ | Never deploy without approval | Always show diff and wait for explicit user approval. |
58
+ | IDs differ between environments | Sandbox copies have NEW IDs. Use `deploy_copy_workspace` return value or `call_on_connection("sandbox", "list_queues", ...)` to get sandbox IDs. Production IDs will 404 in sandbox. |
59
+ | Identify credentials first | Before deployment, verify which token is production vs sandbox (see Credential Identification). |
60
+
61
+ ## Sandbox Connection Setup
62
+
63
+ ```python
64
+ spawn_mcp_connection(connection_id="sandbox", api_token="<SANDBOX_TOKEN>", api_base_url="https://api.elis.rossum.ai/v1")
65
+ ```
66
+
67
+ ## Common Sandbox Operations
68
+
69
+ | Operation | Correct (Sandbox) | Wrong (Production) |
70
+ |-----------|-------------------|-------------------|
71
+ | Update schema | `call_on_connection("sandbox", "update_schema", '{"schema_id": 123, ...}')` | `update_schema(schema_id=123, ...)` |
72
+ | Create schema | `call_on_connection("sandbox", "create_schema", '{"name": "...", "content": [...]}')` | `create_schema(name="...", ...)` |
73
+ | Update queue | `call_on_connection("sandbox", "update_queue", '{"queue_id": 456, ...}')` | `update_queue(queue_id=456, ...)` |
74
+ | Update hook | `call_on_connection("sandbox", "update_hook", '{"hook_id": 789, ...}')` | `update_hook(hook_id=789, ...)` |
75
+
76
+ All read operations (get_schema, get_queue, list_hooks) on sandbox also require `call_on_connection`.
77
+
78
+ ## Tools
79
+
80
+ | Tool | Purpose |
81
+ |------|---------|
82
+ | `deploy_copy_workspace` | Copy workspace to target org |
83
+ | `deploy_pull` | Pull workspace config (schemas, queues, hooks) to local directory as JSON files |
84
+ | `deploy_compare_workspaces` | Diff two local workspace directories, returns structured changes |
85
+ | `deploy_to_org` | Deploy to target org (`dry_run=True` first) |
86
+
87
+ ## Before/After Diff is Mandatory
88
+
89
+ **`deploy_compare_workspaces` compares local JSON files, not remote APIs.** Without pulling, there are no files to compare.
90
+
91
+ | Step | Command | Output Directory |
92
+ |------|---------|------------------|
93
+ | 1. Pull baseline | `deploy_pull(org_id=..., workspace_path="./before", token=SANDBOX_TOKEN)` | `./before/` |
94
+ | 2. Make modifications | `call_on_connection("sandbox", ...)` | - |
95
+ | 3. Pull modified state | `deploy_pull(org_id=..., workspace_path="./after", token=SANDBOX_TOKEN)` | `./after/` |
96
+ | 4. Compare | `deploy_compare_workspaces(source_workspace_path="./before", target_workspace_path="./after")` | Diff output |
97
+
98
+ **Constraint**: Steps 1 and 3 are prerequisites for step 4. Skipping pull = empty comparison = deployment failure.
99
+
100
+ **Always show the diff output to the user before deployment.** This is the user's only chance to review changes before they go to production.
101
+
102
+ Do NOT create markdown files for diffs unless user requests.
@@ -0,0 +1,61 @@
1
+ # Schema Patching Skill
2
+
3
+ **Goal**: Add, update, or remove individual schema fields.
4
+
5
+ ## Tool
6
+
7
+ ```
8
+ patch_schema_with_subagent(schema_id="12345", changes='[{"action": "add", "id": "invoice_number", "parent_section": "header_section", "type": "string", "label": "Invoice Number"}]')
9
+ ```
10
+
11
+ Sub-agent handles fetching, applying, and verifying changes.
12
+
13
+ ## Changes Format
14
+
15
+ Each change object in the `changes` array:
16
+
17
+ | Field | Required | Description |
18
+ |-------|----------|-------------|
19
+ | `action` | No | "add" (default) or "remove" |
20
+ | `id` | Yes | Field ID (schema_id) |
21
+ | `parent_section` | For add | Section ID to add field to |
22
+ | `type` | For add | string, number, date, enum |
23
+ | `label` | No | Defaults to id |
24
+
25
+ ## Field Types
26
+
27
+ | Type | Extra Fields |
28
+ |------|--------------|
29
+ | `string` | `default_value`, `constraints` |
30
+ | `number` | `default_value` |
31
+ | `date` | `format` |
32
+ | `enum` | `options: [{"value": "v1", "label": "Label 1"}]` |
33
+
34
+ Not supported: multiline fields. Ignore multiline requests - use regular `string` type instead.
35
+
36
+ ## UI Configuration
37
+
38
+ Optional `ui_configuration` object controls field behavior in the UI. Only set properties when explicitly requested - do not add ui_configuration if the user hasn't specified type or edit behavior.
39
+
40
+ | Property | Valid Values | Default |
41
+ |----------|--------------|---------|
42
+ | `type` | `captured`, `data`, `manual`, `formula`, `reasoning`, `null` | `null` |
43
+ | `edit` | `enabled`, `enabled_without_warning`, `disabled` | `enabled` |
44
+
45
+ Type meanings:
46
+ - `captured` - Value extracted by AI/OCR from document
47
+ - `data` - Value filled by extensions (no bounding box)
48
+ - `manual` - User-entered value (no bounding box)
49
+ - `formula` - Computed from formula definition
50
+ - `reasoning` - Updated per prompt and context
51
+ - `null` - Unset, behaves like captured
52
+
53
+ Common patterns:
54
+ - Formula field: `{"type": "formula", "edit": "disabled"}`
55
+ - Read-only captured field: `{"type": "captured", "edit": "disabled"}`
56
+ - Extension-filled field: `{"type": "data"}`
57
+
58
+ ## Cross-Reference
59
+
60
+ - Schema customization during queue creation: load `organization-setup` skill
61
+ - Sandbox testing before production: load `rossum-deployment` skill
@@ -0,0 +1,23 @@
1
+ # Schema Pruning Skill
2
+
3
+ **Goal**: Remove unwanted fields from schema in one call.
4
+
5
+ ## Tool
6
+
7
+ ```
8
+ prune_schema_fields(schema_id=12345, fields_to_keep=["invoice_number", "invoice_date", "total_amount"])
9
+ ```
10
+
11
+ Returns `{removed_fields: [...], remaining_fields: [...]}`.
12
+
13
+ ## Behavior
14
+
15
+ - Specify leaf field IDs only
16
+ - Parent containers (sections, multivalues, tuples) preserved automatically
17
+ - Sections with no remaining children are removed automatically (API rejects empty sections)
18
+ - Alternative: use `fields_to_remove` to remove specific fields instead
19
+
20
+ ## Cross-Reference
21
+
22
+ - Adding fields after pruning: load `schema-patching` skill
23
+ - Queue creation: load `organization-setup` skill
@@ -0,0 +1,45 @@
1
+ # UI Settings Skill
2
+
3
+ **Goal**: Update queue UI settings (`settings.annotation_list_table.columns`) without corrupting structure.
4
+
5
+ ## Workflow
6
+
7
+ 1. Fetch current settings via `get_queue`
8
+ 2. Modify only `columns` array, preserve all other keys
9
+ 3. Patch via `update_queue(queue_id, queue_data={"settings": settings})`
10
+
11
+ ## Column Types
12
+
13
+ | Type | Required Fields | Optional |
14
+ |------|-----------------|----------|
15
+ | `meta` | `column_type`, `meta_name`, `visible` | `width` (default: 170.0) |
16
+ | `schema` | `column_type`, `schema_id`, `data_type`, `visible` | `width` |
17
+
18
+ ### Meta `meta_name` Values
19
+
20
+ `status`, `original_file_name`, `labels`, `assignees`, `queue`, `details`, `created_at`, `modified_at`, `confirmed_at`, `exported_at`, `rejected_at`, `deleted_at`, `assigned_at`, `modifier`, `confirmed_by`, `exported_by`, `export_failed_at`, `rejected_by`, `deleted_by`
21
+
22
+ ### Schema `data_type` Values
23
+
24
+ `string`, `number`, `date`
25
+
26
+ ## Constraints
27
+
28
+ | Rule | Rationale |
29
+ |------|-----------|
30
+ | `width` must be float | `170.0` not `170` |
31
+ | Validate `schema_id` exists | Check queue schema before adding |
32
+ | Preserve column order | Unless explicitly reordering |
33
+
34
+ ## Default Columns
35
+
36
+ These columns are always present in the UI by default. To hide them, set `visible: false` explicitly—omitting them from the list does NOT hide them:
37
+
38
+ `deleted_at`, `labels`, `created_at`, `created_by`, `modified_at`, `modified_by`, `deleted_by`, `rejected_at`, `rejected_by`, `confirmed_at`, `confirmed_by`, `exported_at`, `export_failed_at`, `exported_by`
39
+
40
+ ## Column List Behavior
41
+
42
+ | User Request | Action |
43
+ |--------------|--------|
44
+ | "Add column X" | Keep existing columns, append new |
45
+ | Provides full list | Include listed columns with `visible: true`, set unlisted default columns to `visible: false` |
@@ -0,0 +1 @@
1
+ """Streamlit test-bed application for the Rossum Agent."""